const Client = require("../redis/index");

//redis 相关get set del 
exports.caseTime = 3600 * 12;
exports.delR = async (dbIndex,key)=>{
    await select(dbIndex);
    await Client.del(key);
}
exports.delDB = async (dbIndex) =>{
    await select(dbIndex)
    await Client.flushDb()
}
exports.getR = async (dbIndex,key)=>{
    await select(dbIndex);
    const result =  await Client.get(key);
    return result
}

exports.setR = async (dbIndex,key,val,op={})=>{
    await select(dbIndex);

    await Client.set(key,val,op);
}
exports.addOne = async(key)=>{
    await select(5);
    await Client.incr(key);
}


async function select(dbIndex){

    await Client.select(dbIndex);
    
}
